package org.lcb.demo.shiyan3.service.imp;

import org.lcb.demo.shiyan3.mapper.CartMapper;
import org.lcb.demo.shiyan3.service.CartService;
import org.lcb.demo.shiyan3.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Cart;

import java.util.List;

@Service
public class CartServiceImp implements CartService {
    @Autowired
    CartMapper cartMapper;
    @Override
    public List<Cart> getList() {
        return cartMapper.selectCartList();
    }

    @Override
    public void deleteCartById(int id) {
        cartMapper.deleteCartById(id);
    }

    @Override
    public void updateCartNumById(int id, int quantity) {
        cartMapper.updateProductNum(id,
                quantity);
    }

    @Override
    public void insertIntoCart(int productId, int quantity) {
        cartMapper.InsertProduct(productId,quantity);
    }
}
